<?php
Configure::write('debug', 0);
$title = mb_convert_encoding($mmls['0']['Article']['title'],'SJIS','UTF-8');
?>
[mms-file]
version=0
[infomation]
title=<?php echo $title."\n"; ?>
auther=<?php echo $mmls['0']['User']['username']."\n"; ?>
genelator=Lolerei
rythmNum=4
rythmBase=4
timeBase=96
ref=http://mabinogi.logue.be/articles/<?php echo $mmls['0']['Article']['id']."\n" ?>
<?php
$ch = 0;
foreach ($mmls as $mml){
	if (isset($mml['Mml']['name'])) {
		$track_name = mb_convert_encoding($mml['Mml']['name'],'SJIS','UTF-8');
	}else{
		$track_name = 'Track '.$ch;
	}
?>
[part<?php echo $ch; ?>]
name=<?php echo $track_name."\n"; ?>
instrument=<?php echo $mml['Instrument']['mmlseq'] . "\n"; ?>
instrumentPet=-1
marker=-1
panpot=<?php echo ($mml['Mml']['pan']-64). "\n"; ?>
ch0_color=ffff0000
ch0_mml=<?php echo ereg_replace("\r|\n","",$mml['Mml']['ch1']). "\n"; ?>
ch1_color=ffff5b5b
ch1_mml=<?php echo ereg_replace("\r|\n","",$mml['Mml']['ch2']). "\n"; ?>
ch2_color=ffffa0a0
ch2_mml=<?php echo ereg_replace("\r|\n","",$mml['Mml']['ch3']). "\n"; ?>
<?php
	$ch++;
}
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="'.$title.'.mms"');
?>